package com.whw.fy.controller;

import com.whw.fy.entity.Message;
import com.whw.fy.entity.ScheduleDataNo;
import com.whw.fy.service.ScheduleDataNoService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@Api(tags = "排课时间段模块")
@RestController
@RequestMapping("/api/ScheduleDataNo")
public class ScheduleDataNoController {
    @Resource
    private ScheduleDataNoService scheduleDataNoService;

    @ApiOperation(value = "获得所有的排课时间段")
    @GetMapping("/all")
    public Message selectALL(){
        return scheduleDataNoService.selectALL();
    }

    @ApiOperation(value = "根据id获得排课时间段")
    @GetMapping("/id")
    public Message selectById(int id){
        return scheduleDataNoService.selectByPrimaryKey(id);
    }

    @ApiOperation(value = "增加")
    @PostMapping("/")
    public Message insert(ScheduleDataNo scheduleDataNo){
        return scheduleDataNoService.insertSelective(scheduleDataNo);
    }

    @ApiOperation(value = "修改")
    @PutMapping("/")
    public Message update(ScheduleDataNo scheduleDataNo){
        return scheduleDataNoService.updateByPrimaryKeySelective(scheduleDataNo);
    }

    @ApiOperation(value = "根据id删除")
    @DeleteMapping("/")
    public Message delete(int id){
        return scheduleDataNoService.deleteByPrimaryKey(id);
    }
}
